(global.webpackJsonp = global.webpackJsonp || []).push([ [ "components/kp-audio/index" ], {
    "010f": function(t, i, e) {
        (function(t) {
            Object.defineProperty(i, "__esModule", {
                value: !0
            }), i.default = void 0;
            var a = e("26cb"), o = e("db8f"), n = e("9b04"), u = e("4771"), s = e("a71e");
            function r(t, i) {
                var e = Object.keys(t);
                if (Object.getOwnPropertySymbols) {
                    var a = Object.getOwnPropertySymbols(t);
                    i && (a = a.filter(function(i) {
                        return Object.getOwnPropertyDescriptor(t, i).enumerable;
                    })), e.push.apply(e, a);
                }
                return e;
            }
            function d(t, i, e) {
                return i in t ? Object.defineProperty(t, i, {
                    value: e,
                    enumerable: !0,
                    configurable: !0,
                    writable: !0
                }) : t[i] = e, t;
            }
            e("99f3"), function(t) {
                t && t.__esModule;
            }(e("03b8"));
            var c = {
                props: {
                    audioData: {
                        type: Object,
                        default: function() {
                            return {};
                        }
                    }
                },
                data: function() {
                    return {
                        lock: !1,
                        status: 1,
                        currentTime: 0,
                        duration: 100,
                        audioContext: "",
                        currentData: {},
                        initialTime: "",
                        playSpeed: 1,
                        startTime: "",
                        endTime: "",
                        updateAudio: !1,
                        time: "",
                        timeShiQi: "",
                        timeIsloads: ""
                    };
                },
                watch: {
                    audioData: function() {
                        this.audioData = this.audioData, this.audioContext.src = this.audioData.src;
                    }
                },
                computed: function(t) {
                    for (var i = 1; i < arguments.length; i++) {
                        var e = null != arguments[i] ? arguments[i] : {};
                        i % 2 ? r(Object(e), !0).forEach(function(i) {
                            d(t, i, e[i]);
                        }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(e)) : r(Object(e)).forEach(function(i) {
                            Object.defineProperty(t, i, Object.getOwnPropertyDescriptor(e, i));
                        });
                    }
                    return t;
                }({
                    timer: function() {
                        return (0, o.formatSeconds)(this.currentTime);
                    },
                    overTimer: function() {
                        return (0, o.formatSeconds)(this.duration);
                    }
                }, (0, a.mapGetters)([ "mainColor" ])),
                created: function() {
                    this.newPageData(), this.audioContext = wx.getBackgroundAudioManager(), this.onTimeUpdate(), 
                    this.onCanplay(), this.onEnded();
                },
                mounted: function() {
                    var t = this;
                    t.$nextTick(function() {}), t.audioContext.onPause(function() {
                        t.stopPlayAudios(0);
                    }), t.audioContext.onStop(function() {
                        t.stopPlayAudios(0);
                    });
                },
                onHide: function() {},
                onUnload: function() {},
                methods: {
                    chooseTime: function() {
                        this.$emit("chooseTime", !0);
                    },
                    setTime: function(t) {
                        var i = this, e = 60 * parseFloat(t) * 1e3;
                        i.timeShiQi = setTimeout(function() {
                            i.stopAudio(), clearTimeout(i.timeShiQi);
                        }, e);
                    },
                    newPageData: function() {},
                    setRate: function(t) {
                        if (0 == this.audioData.is_speed_play) return !1;
                        this.playSpeed = t, this.audioContext.playbackRate = Number(t);
                    },
                    stopPlayAudios: function(t, i, e, a) {
                        var r = this;
                        (0, u.getStorageSync)("userInfo").then(function(u) {
                            var d = JSON.parse(u.data);
                            if (!(0, s.isEmpty)(d.id)) {
                                r.user_id = u.id;
                                var c = {
                                    sid: (0, s.isEmpty)(i) ? r.audioData.sid : i,
                                    course_id: r.audioData.course_id,
                                    end_second: parseInt(r.currentTime),
                                    is_complete: t,
                                    duration: parseInt((0, o.timeDiff)(r.startTime)) > 24e3 ? 0 : parseInt((0, o.timeDiff)(r.startTime)),
                                    user_id: d.id,
                                    isLoading: !1
                                };
                                (0, n.stopPlay)(c).then(function(t) {}), (0, s.isEmpty)(i) || 1 == t || r.$emit("swichAudio", e, a);
                            }
                        }, function(t) {});
                    },
                    swichMenuAudio: function(t, i, e) {
                        var a = {
                            id: t.id,
                            currentTime: this.currentTime,
                            sid: t.sid,
                            url: t.url,
                            end_second: t.end_second,
                            second: t.second,
                            title: t.title,
                            try_time: t.try_time,
                            is_end_study: t.is_end_study,
                            is_try: t.is_try
                        };
                        this.stopPlayAudios(0, e, a, i);
                    },
                    playAudioS: function() {
                        this.audioContext.src = this.audioData.src, this.audioContext.play();
                    },
                    audioOpreation: function() {
                        var t = this;
                        if (0 == t.audioData.code && 1 == t.audioData.is_try && 0 != t.audioData.try_time && parseInt(this.currentTime) >= parseInt(t.audioData.try_time)) return t.$toast("试听已结束", "none"), 
                        t.stopAudio(), !1;
                        if (0 == t.audioData.code && 1 == t.audioData.is_try && 0 == t.audioData.try_time && parseInt(this.currentTime) >= parseInt(t.audioData.second)) return t.$toast("试听已结束", "none"), 
                        t.stopAudio(), !1;
                        2 == this.status ? this.audioContext.pause() : this.audioContext.play();
                        var i = 2 == this.status;
                        this.status, this.$emit("isPalyFlag", i), this.status = 2 == this.status ? 1 : 2;
                    },
                    playAudio: function() {
                        var i = this;
                        return 0 == i.audioData.code && 1 == i.audioData.is_try && 0 != i.audioData.try_time && parseInt(this.currentTime) > parseInt(i.audioData.try_time) || 0 == i.audioData.code && 1 == i.audioData.is_try && 0 == i.audioData.try_time && parseInt(this.currentTime) >= parseInt(i.audioData.second) ? (i.$toast("试听已结束", "none"), 
                        i.stopAudio(), !1) : (this.status = 2, this.startTime = new Date().getTime(), this.$emit("isPalyFlag", !1), 
                        void i.$nextTick(function() {
                            i.audioContext || (this.audioContext = t.getBackgroundAudioManager(), this.onTimeUpdate(), 
                            this.onCanplay(), this.onEnded()), setTimeout(function() {
                                i.playTrueAudio();
                            }, 200);
                        }));
                    },
                    playTrueAudio: function() {
                        var t = this;
                        this.audioContext.title = this.audioData.title, this.audioContext.epname = this.audioData.title, 
                        this.audioContext.singer = this.audioData.title, this.audioContext.coverImgUrl = "", 
                        this.audioContext.src = this.audioData.src, this.audioContext.onPlay(function() {}), 
                        0 != t.audioData.code && parseInt(t.audioData.seek) > 0 && parseInt(t.audioData.second) - parseInt(t.audioData.seek) > 2 && (t.updateAudio = !1, 
                        this.time = parseInt(t.audioData.seek));
                    },
                    stopTrueAudio: function(t, i, e) {},
                    stopAudio: function() {
                        this.audioContext.pause(), this.status = 1, this.stopPlayAudios(0), this.$emit("isPalyFlag", !0);
                    },
                    timeupdate: function(t) {},
                    onTimeUpdate: function() {
                        var t = this, i = this;
                        this.audioContext.onTimeUpdate(function() {
                            return 0 == i.audioData.code && 1 == i.audioData.is_try && 0 != i.audioData.try_time && parseInt(t.audioContext.currentTime) > parseInt(i.audioData.try_time) || 0 == i.audioData.code && 1 == i.audioData.is_try && 0 == i.audioData.try_time && parseInt(t.audioContext.currentTime) >= parseInt(i.audioData.second) ? (i.timeIsloads = setTimeout(function() {
                                i.$toast("试听已结束", "none"), clearTimeout(i.timeIsloads);
                            }, 800), i.audioContext.pause(), i.status = 1, !1) : ((0, s.isEmpty)(i.time) ? i.updateAudio = !0 : (i.audioContext.seek(i.time), 
                            i.currentTime = i.time, i.duration = parseInt(i.audioData.second), i.time = ""), 
                            void (1 == i.updateAudio && (t.currentTime = parseInt(t.audioContext.currentTime), 
                            t.duration = parseInt(t.audioContext.duration))));
                        }), i.audioContext.onSeeked(function() {
                            i.updateAudio = !0;
                        });
                    },
                    onEnd: function() {},
                    onEnded: function() {
                        var t = this;
                        this.audioContext.onEnded(function(i) {
                            t.status = 1, t.currentTime = 0, t.stopPlayAudios(1, t.audioData.sid), t.$emit("endAudio", t.audioData.index);
                        });
                    },
                    onError: function() {
                        var t = this;
                        this.audioContext.onError(function(i) {
                            t.status = 1, t.currentTime = 0;
                        }), this.stopPlayAudios(0), this.$emit("isPalyFlag", !0);
                    },
                    sliderChange: function(t) {
                        var i = this;
                        if (0 == i.audioData.code && 1 == i.audioData.is_try && 0 != i.audioData.try_time && parseInt(this.duration) > parseInt(i.audioData.try_time)) return this.audioContext.seek(parseInt(i.audioData.try_time)), 
                        this.currentTime = parseInt(i.audioData.try_time), i.$toast("超出试看范围", "none"), i.stopAudio(), 
                        !1;
                        this.updateAudio = !0, this.audioContext.seek(parseInt(t.detail.value)), this.currentTime = parseInt(t.detail.value);
                    },
                    sliderChanging: function(t) {
                        this.updateAudio = !1;
                    },
                    loadedmetadata: function(t) {
                        this.duration = t.detail.duration;
                    },
                    onCanplay: function() {
                        this.audioContext.onCanplay(function() {});
                    },
                    audioSeek: function(t) {
                        this.audioContext.seek(t);
                    },
                    beforeTime: function() {
                        if (0 == this.audioData.is_speed_play) return !1;
                        if (2 == this.status && Number(this.currentTime) > 15) {
                            var t = parseInt(Number(this.currentTime) - 15);
                            this.audioContext.seek(t), this.currentTime = t;
                        }
                    },
                    afterTime: function() {
                        var t = this;
                        if (0 == this.audioData.is_speed_play) return !1;
                        if (0 == t.audioData.code && 1 == t.audioData.is_try && 0 != t.audioData.try_time && parseInt(this.duration) + 15 > parseInt(t.audioData.try_time)) return t.$toast("超出试看范围", "none"), 
                        !1;
                        if (2 == this.status && this.duration - Number(this.currentTime) > 15) {
                            var i = parseInt(Number(this.currentTime) + 15);
                            this.audioContext.seek(i), this.currentTime = i;
                        }
                    }
                }
            };
            i.default = c;
        }).call(this, e("543d").default);
    },
    "1b94": function(t, i, e) {
        var a = e("c237");
        e.n(a).a;
    },
    "9e03": function(t, i, e) {
        e.r(i);
        var a = e("c313"), o = e("d15c");
        for (var n in o) "default" !== n && function(t) {
            e.d(i, t, function() {
                return o[t];
            });
        }(n);
        e("1b94");
        var u = e("f0c5"), s = Object(u.a)(o.default, a.b, a.c, !1, null, "6af3f24d", null, !1, a.a, void 0);
        i.default = s.exports;
    },
    c237: function(t, i, e) {},
    c313: function(t, i, e) {
        e.d(i, "b", function() {
            return a;
        }), e.d(i, "c", function() {
            return o;
        }), e.d(i, "a", function() {});
        var a = function() {
            var t = this;
            t.$createElement;
            t._self._c, t._isMounted || (t.e0 = function(i) {
                t.lock = !0;
            }, t.e1 = function(i) {
                t.lock = !1;
            });
        }, o = [];
    },
    d15c: function(t, i, e) {
        e.r(i);
        var a = e("010f"), o = e.n(a);
        for (var n in a) "default" !== n && function(t) {
            e.d(i, t, function() {
                return a[t];
            });
        }(n);
        i.default = o.a;
    }
} ]), (global.webpackJsonp = global.webpackJsonp || []).push([ "components/kp-audio/index-create-component", {
    "components/kp-audio/index-create-component": function(t, i, e) {
        e("543d").createComponent(e("9e03"));
    }
}, [ [ "components/kp-audio/index-create-component" ] ] ]);